<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <h1>{{message}}</h1>
  <h1>{{fullName}}</h1>
  <h1>{{fullName}}</h1>
  <h1>{{fullName}}</h1>
  <h1>{{fullName}}</h1>

  <h1>{{getFullName()}}</h1>
  <h1>{{getFullName()}}</h1>
  <h1>{{getFullName()}}</h1>
  <h1>{{getFullName()}}</h1>
</div>

<script src="../js/vue.js"></script>
<script>
  //let(变量)和const(常量)
  const app = new Vue({
    el: '#app',
    data: {
      message: '中国牛蛙！',
      firstName: 'James',
      lastName: 'Gosling'
    },
    computed: {
      fullName: {
        get: function () {
          console.log('fullName');
          return this.firstName+ ' ' +this.lastName;
        }
      }
    },
    methods: {
      getFullName: function (){
        console.log('getFullName');
        return this.firstName+ ' ' +this.lastName;
      }
    }
  })
</script>
</body>
</html>